import mongoose = require("mongoose");

module proto
{
	export class User
	{
		public createdAt:Date;
		public email:string;
		public firstName:string;
		public lastName:string;
	}
}

export var UserSchema: mongoose.Schema = new mongoose.Schema(
	{
		createdAt:Date,
		email:String,
		firstName:String,
		lastName:String
	}
);

UserSchema.pre("save",function(next){
	console.log("userSchema create...");
	if(!this.createdAt)
	{
		this.createdAt = new Date();
	}
});